Often, video compression is performed to reduce the quantity of data used for representing a digital image and to process the digital image faster while transferring the digital image from one device to another. Video compression and video decompression are performed in order to reduce channel bandwidth and to reduce memory requirements. A video codec includes a video encoder to perform video compression and a video decoder to perform video decompression. A video codec may also be referred to as a video encoder.
One of the techniques used in video compression is motion estimation. Motion estimation includes extracting motion information from a video sequence. The video sequence can be defined as a combination of one or more digital images (frames). Extracting the motion information from the video sequence includes determining motion vectors. The motion vectors describe spatial displacement of data in adjacent frames in the video sequence. In one example, a motion vector is a two-dimensional vector that represents an offset from coordinates in a current frame to the coordinates in a reference frame. In one example, motion estimation can be defined as a technique where a current frame is compared with a previous frame and information about similar pixels is stored and reused to generate a frame subsequent to the current frame. In another example, motion estimation involves searching for a best match between every block of pixels in the current frame and a block of pixels in the previous frame, hereinafter referred to as the reference frame. The pixel value information, after a search, can include motion vectors, pixel values, or any other pixel information required during the compression. In one example, motion compensation includes using the motion vectors to generate one or more frames from a current frame.
In an existing technique, motion estimation involves fetching a portion of the reference frame from an external memory (for example a double data rate (DDR) memory) and storing it in an on-chip memory (for example a static random access memory (SRAM)) present inside the video codec. Pixels in a frame may be grouped into blocks, and these blocks may be called macroblocks. Motion estimation involves searching for a best match between every block of pixels in the current frame with a block of pixels in the reference frame. Blocks of pixels may be accessed using either a sliding window technique or a growing window technique. The sliding window technique allows reuse of reference frame data in a horizontal direction. Fetching relatively large portion of the reference frame data from external memory each time when a search is to be performed makes the sliding window technique bandwidth inefficient. The growing window technique allows reuse of data from the reference frame in both horizontal and vertical directions. For this, the reference data for entire row of macro-blocks needs to be stored in on-chip memory so that it can be used by the next macro-block row. This makes growing window technique memory inefficient. Thus, both sliding window and growing window techniques impose at least one limitation of bandwidth requirement and memory requirement. There has been a need to reduce both the bandwidth required by the sliding window technique and the amount of memory required by the growing window technique.